Skip to content

gabalz/cvxreg

Repository files navigation

Build License: MIT

This Python library implements convex regression algorithms of various papers.


ALGORITHMS

Convex Nonparametric Least-Squares (CNLS)
algorithm/cnls/cnls.py

Convex Optimization, Section 6.5.5,
Stephen Boyd, Lieven Vandenberghe,
Cambridge University Press, 2004 (book).

Least-Squares Partition Algorithm (LSPA)
algorithm/lspa/lspa.py

Convex Piecewise-Linear Fitting,
Alessandro Magnani, Stephen P. Boyd,
Optimization and Engineering, vol.10, 2009 (paper).

Convex Adaptive Partitioning (CAP), and FastCAP
algorithm/cap/cap.py

Multivariate Convex Regression with Adaptive Partitioning,
Lauren A. Hannah, David B. Dunson,
JMLR, vol.14, 2013 (paper, MATLAB code)

Partitioning Convex Nonparametric Least-Squares (PCNLS) with uniformly random Voronoi partition
algorithm/pcnls/pcnls_voronoi.py

Near-Optimal Max-Affine Estimators for Convex Regression,
Gabor Balazs, Andras Gyorgy, Csaba Szepesvari,
AISTATS, 2015 (paper, MATLAB code).

Adaptive Max-Affine Partitioning (AMAP)
algorithm/amap/amap.py

Convex Regression: Theory, Practice, and Applications, Section 6.2.3,
Gabor Balazs,
PhD Thesis, University of Alberta, 2016 (thesis, MATLAB code).

Adaptively Partitioning Convex Nonparametric Least-Squares (APCNLS)
algorithm/apcnls/apcnls.py

Adaptively Partitioning Max-Affine Estimators for Convex Regression,
Gabor Balazs,
AISTATS, 2022 (paper).


PYTHON ENVIRONMENT

The installation of a minimal virtual environment to show the requirements of running the code.

python3 -m venv .../pyenv  # creating empty virtual environment
source .../pyenv/bin/activate  # activating the virtual environment

pip install --upgrade pip
pip install --upgrade setuptools

pip install numpy scipy osqp

# Jupyter notebook (Optional):
pip install joblib pandas 
pip install widgetsnbextension jupyter matplotlib

UNIT TESTING

For examples, see the doctests in the files mentioned in the ALGORITHMS section above.

All the doctests can be run by using the nose package:

source .../pyenv/bin/activate  # if not done yet
pip install pytest
cd .../cvxreg  # go to the root directory of this project
PYTHONPATH=. pytest --doctest-modules

EXPERIMENTS

There is a Jupyter notebook ipynb/cvxreg_synt.ipynb which provides basic experimenting on synthetic convex regression problems.

About

Convex Regression.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published